Back to Contents        Previous        Next





17. The ‘redraw’ process

As you will already have seen, if you have a window where all the action takes place in icons, the Wimp automatically does all the updating for you when you open/move/update the window.

However, if your window has some graphics/text plotted straight onto the window background (which we will call ‘user graphics’) then the Wimp needs your help to draw/redraw them when necessary. For example, you could be using PROCwimp_plotwindowcircle() to draw a circle in a window.

The Wimp asks for this help by asking you to ‘redraw’ all or part of the user-graphics whenever needed. Mostly, redrawing is necessary every time a window is moved/scrolled etc., because moving/scrolling a window on the screen is done by successively deleting and re-opening it.

It is vital to note that, in order for the redraw process to work, the window must have its “auto-redraw” flag unset - which is normally done in the template editor.

In Dr Wimp, when the Wimp wants a redraw, PROCuser_redraw() is called automatically. In its parameters, the handle of the window is passed, plus the position of the particular rectangle on the screen that needs to be redrawn - and the Wimp may call PROCuser_redraw() several times for different rectangles, to build up the total area to be redrawn.

The programmer has to decide how best to redraw each rectangle: the simplest option is to redraw all the user-graphics in the window - and this is often acceptable. But if the window is large and/or the graphics complicated a total redraw may take too much time and slow down other user-actions e.g. moving the window. In these cases you will need to arrange the coding so that only the parts required are redrawn, although this adds complication to the coding. (The Example application !Grid shows how this can be done.)

This Manual will not cover in detail the principles behind the redraw process (although this is done in the charity book “Dr Wimp’s Surgery”, mentioned in Section 1.1).

However, Dr Wimp has many wimp-functions to assist with the redraw process and later sections give details about the more likely needs e.g. Section 2.19 (for displaying Drawfiles, Sprites and JPEGs) and Section 2.21 (for plotting Text). There is also ‘Elixir_01’ for helping to provide fast-scrolling lists with plotted text.

There are also mini-applications in the Examples folder showing how PROCuser_redraw() and ‘Elixir_01’ are used in practice.





Top of page        Back to Contents        Previous        Next